﻿using SuporeSliplampApp.Util;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace SuporeSliplampApp.ViewModels
{
    public class DateFormatConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is DateTime date)
            {
                string dateFormat = "yyyy-MM-dd"; 
                switch (Common.DateIndex)
                {
                    case 0:
                        dateFormat = "yyyy-MM-dd";
                        break;
                    case 1:
                        dateFormat = "MM-yyyy-dd";
                        break;
                    case 2:
                        dateFormat = "dd-MM-yyyy";
                        break;
                }
                return date.ToString(dateFormat);
            }
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
